package org.zqh.ncc.utils;

import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;

public class TimeUtil {

    public static long getTodayZeroSeconds() {
        Calendar calendar = Calendar.getInstance();
        calendar.set(Calendar.HOUR_OF_DAY, 0);
        calendar.set(Calendar.MINUTE, 0);
        calendar.set(Calendar.SECOND, 0);
        calendar.set(Calendar.MILLISECOND, 0);
        return System.currentTimeMillis() - calendar.getTimeInMillis();
    }

    public static String getStrDateFormat(Date date) {
        if (null == date) {
            return null;
        } else {
            SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
            return sdf.format(date);
        }
    }


    public static void main(String[] args) {
        System.out.println(getTodayZeroSeconds());
    }

}
